package com.jt.pojo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

@Data //自动生成get/set/toString/equals/hashcode等方法
@Accessors(chain = true) //重写了set方法，返回this对象，可以链式set赋值
@Component
//@NoArgsConstructor //无参构造
//@AllArgsConstructor //全参构造
@PropertySource(value = "classpath:/dept.properties",encoding = "UTF-8")
public class Dept {
//    从application.yml得到数据
    @Value("${dept.id}")
    private Integer id;
    @Value("${dept.name}")
    private String name;

    //从dept.properties得到数据，必须加注解@PropertySource
    @Value("${dept.id2}")
    private Integer id2;
    @Value("${dept.name2}")
    private String name2;

}
